
log using fpa-bitsaid-main-tables,replace
version 13.1

use fpa-aid_bits_final,clear

set more off
sort dyad year
//table 1
teffects aipw (lnaid lp_polity2  lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lgdpgr_i lpta colonial_tie ln_distance lunsc_member lally lcoldwar) ///
(lbit_ratf lag_tbit lp_polity2 lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lpta lally lunsc_member colonial_tie  lcoldwar) if oecd_i==1&oecd_j==0
outreg2 using bits_aid1, label word dec(3) e(n1 n0) replace addtext() noni nor2 ctitle("AIPW") sortvar(r1vs0.lbit_ratf r0.lbit_ratf)

//table 2: democracies
su dpi_yio
set more off
sort dyad year
///short time horizon
teffects aipw (lnaid lp_polity2  lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lgdpgr_i lpta colonial_tie ln_distance lunsc_member lally lcoldwar) ///
(lbit_ratf lag_tbit lp_polity2 lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lpta lally lunsc_member colonial_tie  lcoldwar) if oecd_i==1&oecd_j==0&dpi_yio<4&dpi_yio!=.&p_polity2>=6&p_polity2!=.
outreg2 using bits_aid2, label word dec(3) e(n1 n0) replace ctitle(Democracy short) noni nor2 sortvar(r1vs0.lbit_ratf r0.lbit_ratf)
///long time horizon
teffects aipw (lnaid lp_polity2  lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lgdpgr_i lpta colonial_tie ln_distance lunsc_member lally lcoldwar) ///
(lbit_ratf lag_tbit lp_polity2 lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lpta lally lunsc_member colonial_tie  lcoldwar) if oecd_i==1&oecd_j==0&dpi_yio>=4&dpi_yio!=.&p_polity2>=6&p_polity2!=.
outreg2 using bits_aid2, label word dec(3) e(n1 n0) append ctitle(Democracy long) noni nor2 cttop("AIPW") sortvar(r1vs0.lbit_ratf r0.lbit_ratf)

//table 3: non-democracies
///short time horizon
teffects aipw (lnaid lp_polity2  lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lgdpgr_i lpta colonial_tie ln_distance lunsc_member lally lcoldwar) ///
(lbit_ratf lag_tbit lp_polity2 lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lpta lally lunsc_member colonial_tie  lcoldwar) if oecd_i==1&oecd_j==0&dpi_yio<10&dpi_yio!=.&p_polity2<6&p_polity2!=.
outreg2 using bits_aid3, label word dec(3) e(n1 n0) replace ctitle(Non-democracy short) noni nor2 sortvar(r1vs0.lbit_ratf r0.lbit_ratf)
///long time horizon
teffects aipw (lnaid lp_polity2  lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lgdpgr_i lpta colonial_tie ln_distance lunsc_member lally lcoldwar) ///
(lbit_ratf lag_tbit lp_polity2 lln_gdppc lwdi_gdpgr lwdi_fdiin lwdi_natrr llnpop lconflict lpta lally lunsc_member colonial_tie  lcoldwar) if oecd_i==1&oecd_j==0&dpi_yio>10&dpi_yio!=.&p_polity2<6&p_polity2!=.
outreg2 using bits_aid3, label word dec(3) e(n1 n0) append ctitle(Non-democracy long) noni nor2 cttop("AIPW") sortvar(r1vs0.lbit_ratf r0.lbit_ratf)

log close